/**
 * 监控页数据请求
 *
 * @版权所有 rem.studio
 */
import { queryMonitorChartData } from '@/services/chartApi';

export default {
  namespace: 'monitor',

  state: {
    compareDonutData: [],
    activeData: [],
    tagData: [],
    monitorData: {}
  },

  effects: {
    *fetch(_, { call, put }) {
      const response = yield call(queryMonitorChartData);
      yield put({
        type: 'save',
        payload: response
      });
    }
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload.data
      };
    }
  }
};
